/*
 *  cSemaphore.h
 *  DtrGuiSrv01
 *
 *  Created by iBook on 2006/8/30.
 *  Copyright 2006 __MyCompanyName__. All rights reserved.
 *
 */



//
// Constant
//
#define SEM_INIT_FAIL		-1


//
// Semaphore Key Value
//
#define SEM_KEY_MAIL_SEND	900
#define SEM_KEY_CTLR_BASE	910 // 1010 + MAX_DTR_IN_HOST
#define SEM_KEY_SM_BASE		920 // 1020 + MAX_DTR_IN_HOST

//
// Extern Global Variables
//
extern SHORT	MailSendSemID;
extern SHORT	CtlSemID[MAX_DTR_IN_HOST];
extern SHORT	SMSemID[MAX_DTR_IN_HOST];


#if defined(ENABLE_LINUX) || defined(ENABLE_SLRS)

#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
    /* union semun is defined by including <sys/sem.h> */
#else
    /* according to X/OPEN we have to define it ourselves */
    union semun {
        int val;                    /* value for SETVAL */
        struct semid_ds *buf;       /* buffer for IPC_STAT, IPC_SET */
        unsigned short int *array;  /* array for GETALL, SETALL */
        struct seminfo *__buf;      /* buffer for IPC_INFO */
    };
#endif

#endif

